#!/usr/bin/perl
#Author: Ian McCown
#Apache Log Project part 2

$log = $ARGV[0];
%browsers = ();

open FILE, "<", $log or die "log not found";
while (<FILE>) {
	$_ =~ /CONNECT .*".*" /;
#	print "$'\n";
	$browsers{$'} += 1;
}
close FILE;

$count = 0;
foreach $value ( sort { $browsers{$b} <=> $browsers{$a} } keys %browsers) {
	$count += 1;
	print "$value = $browsers{$value}\n";
	if ( $count == 10 ) {
		last;
	}
}

